home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
ndr3.exe
/
VERVLM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-04
|
2KB
|
95 lines
/*
VERVLM.C shows how to obtain the version numbers
of VLM.EXE and any VLM loaded by it.
Author: Tim Farley
Copyright 1993, Tim Farley, All Rights Reserved
*/
#include <stdlib.h> /* for NULL */
#include <dos.h> /* for _dos_getvect() or getvect() */
#ifdef __TURBOC__
#define ASM asm
#define GETVECT getvect
#else
/* assume Microsoft C if not Turbo/Borland C */
#define ASM _asm
#define GETVECT _dos_getvect
#endif
/*
Pointer to the VLM entry point
*/
static void (far * VLMentry)(void) = NULL;
/*
DetectVLM detects if the NetWare DOS Requestor
is present & retreives its entry point.
*/
static int DetectVLM( void )
{
unsigned long int2Fvector;
int returnCode;
/* if we've already been called, skip it */
if ( NULL != VLMentry )
return ( 1 );
/*
Make sure INT 2Fh is initialized. This is only
technically necessary to support DOS 2.x.
*/
int2Fvector = (unsigned long)GETVECT( 0x2F );
if ( 0UL == int2Fvector ) /* No INT 2Fh handler? */
return ( 0 ); /* then no IPX! */
ASM {
xor bx,bx /* clear return registers */
mov es,bx
mov ax,7a20h /* FN 7A00: Detect IPX */
xor bx,bx /* BX = 0 returns main entry point */
int 2fh
mov returnCode,ax /* save return code */
mov word ptr VLMentry,bx /* store API entry */
mov word ptr VLMentry+2,es
}
return ( 0 == returnCode ); /* AX = 0 means success */
} /* DetectVLM() */
/*
GetVLMVersion returns the version of a given VLM by
number. Use #1 for VLM.EXE. Returns 0
if not loaded.
*/
int GetVLMVersion( int whichVLM )
{
int returnCode, vlmHigh, vlmLow;
if ( !DetectVLM() )
return( 0 );
ASM {
xor ax,ax /* Source VLM = 0 (we are an app) */
push ax
push whichVLM /* Target VLM */
mov ax,1
push ax /* Target Func: VLM_NOTIFY */
mov bx,0 /* Subfunction: NOTIFY_VER */
call VLMentry
mov returnCode,ax
mov vlmHigh,bx
mov vlmLow,cx
}
if ( 0 != returnCode )
return ( 0 );
return ( ( vlmHigh << 8 ) | vlmLow );
} /* GetVLMVersion() */
/* eof: VERVLM.C */